#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <gmp.h>
#include "gauss-legendre.h"

#define MAX_IT 40
#define IT_FILENAME "resultados/seq"
#define F_PREC 33219613

int main (int argc, char** argv){
	unsigned int it = 0, t;

	t = time(NULL);	

	mpf_set_default_prec(F_PREC);

	init_vals();
	
	do{
		calc_new_a();
		calc_new_b();
		t_use_a();
		t_pre_calc();
		set_new_t();
		pi_use_ab();
		pi_pre_calc();
		pi_end_calc_use_t();
		save_it(IT_FILENAME);
	} while ( check_erro() && MAX_IT > ++it);

	printf("Tempo total %d segundos.\n", (int) time(NULL)-t);

	clear_vars();

	return EXIT_SUCCESS;
}
